﻿/*
* ========================================================================
* 类说明：
*   接口调用使用到的实体
* 
* 作者：HGS   时间：2024/11/4 13:29:54
* 
* 修改者：         时间：           
* 修改说明：
* ========================================================================
*/

using Newtonsoft.Json;
using System.Collections.Generic;

namespace MESLib
{
    public class InsertModel
    {
        [JsonProperty("deviceCode")]
        public string deviceCode { get; set; }
        [JsonProperty("type")]
        public string type { get; set; }
        [JsonProperty("business")]
        public string business { get; set; }
        [JsonProperty("list")]
        public List<detailed> list { get; set; }
        public InsertModel()
        {
            type = "OVER_STATION";
            business = "Laser/包装 AOI";
        }
    }
    public class detailed
    {
        [JsonProperty("sn")]
        public string sn { get; set; }
        [JsonProperty("status")]
        public string status { get; set; }
        /// <summary>
        /// 图片或文件路径
        /// </summary>
        [JsonProperty("imgPath")]
        public string imgPath { get; set; } = "";
        [JsonProperty("badList")]
        public List<badcode> badList { get; set; }

    }
    #region 插入返回数据

    public class InsertReturn
    {
        [JsonProperty("OK")]
        public bool OK { get; set; }
        [JsonProperty("code")]
        public int code { get; set; }
        [JsonProperty("message")]
        public string message { get; set; }
        [JsonProperty("result")]
        public Result result { get; set; }
    }
    public class badcode
    {
        /// <summary>
        /// 固定的错误码（需与MES文档保持一致）
        /// </summary>
        [JsonProperty("badCode")]
        public string badCode { get; set; }
        /// <summary>
        /// 错误描述
        /// </summary>
        [JsonProperty("badPosition")]
        public string badPosition { get; set; }
        [JsonProperty("picUrlList")]
        public List<string> picUrlList { get; set; }
        [JsonProperty("docUrl")]
        public string docUrl { get; set; }
    }
    #endregion
    public struct MesReturn
    {
        [JsonProperty("OK")]
        public bool OK { get; set; }
        [JsonProperty("message")]
        public string message { get; set; }
        [JsonProperty("code")]
        public int code { get; set; }
    }
    #region  查询SN返回数据

    public class QueryReturn
    {
        [JsonProperty("code")]
        public int code { get; set; }
        [JsonProperty("message")]
        public string message { get; set; }
        [JsonProperty("success")]
        public bool success { get; set; }
        [JsonProperty("result")]
        public snResult result { get; set; }
        // public Data data { get; set; }
        /*
         * {
"success":true,
"message":"操作成功！",
"code":200,
"result":{
        "type":"PRODUCT_SN",
    "list":[{"sn":"123242342","status":"N","message":""}]},
    "timestamp":1723081607326
        }
         */
    }
    public class snResult
    {
        [JsonProperty("type")]
        public string type { get; set; }
        [JsonProperty("timestamp")]
        public string timestamp { get; set; }
        [JsonProperty("list")]
        public List<snState> list { get; set; }
        /*
         * "type":"PRODUCT_SN",
         "list":[{"sn":"123242342","status":"N","message":""}]},
         "timestamp":1723081607326
         */
    }
    public class snState
    {
        [JsonProperty("sn")]
        public string sn { get; set; }
        [JsonProperty("status")]
        public string status { get; set; }
        [JsonProperty("message")]
        public string message { get; set; }
    }
    #endregion
    /// <summary>
    /// 产品标签验证数据模型
    /// </summary>
    public class QueryModel
    {
        /*
         * {
"type":"ORDER_PRODUCT_SN",
"business":"2",
"deviceCode":"3",
"list":[
    {
        "productSn":"123242342"
    }
]
}
         */
        /// <summary>
        /// 默认值 ORDER_PRODUCT_SN
        /// </summary>
        [JsonProperty("type")]
        public string type { get; set; }
        /// <summary>
        /// 当前工序编码
        /// </summary>
        [JsonProperty("business")]
        public string business { get; set; }
        [JsonProperty("deviceCode")]
        public string deviceCode { get; set; }
        [JsonProperty("list")]
        public List<SN> list { get; set; }

    }
    public class SN
    {
        [JsonProperty("productSn")]
        public string productSn { get; set; }
    }
}
